//
//  WDGoutWaitAssignTopDetailView.m
//  wd-serviceapp
//
//  Created by Bin Tang on 2024/9/7.
//

#import "WDGoutWaitAssignTopDetailView.h"

@interface WDGoutWaitAssignTopDetailView ()
@property (nonatomic, strong) CALayer *bottomLine;

@property (nonatomic, strong) UILabel *detailLabel;

@property (nonatomic, strong) UIImageView *moreImgView;


@end

@implementation WDGoutWaitAssignTopDetailView

- (void)initWithSubView {
    [super initWithSubView];
    
    [self initWithBottomLine];
    
    [self initWithDetailLabel];
    
    [self initWithMoreImgView];
    
    @weakify(self);
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id  _Nonnull sender) {
        @strongify(self);
        if (self.touchDetailBlock) {
            self.touchDetailBlock();
        }
    }];
    [self addGestureRecognizer:tap];
}

- (void)initWithBottomLine {
    if (!_bottomLine) {
        CGRect frame = CGRectMake(20, self.height - 1, self.width - 40, 1);
        _bottomLine = [CALayer drawLine:self frame:frame lineColor:[UIColor colorWithHexString:@"#EEEEEE"]];
    }
}

- (void)initWithDetailLabel {
    if (!_detailLabel) {
        CGRect frame = CGRectMake(20, (self.height - 1 - 20) * 0.5, 200, 20);
        _detailLabel = [UILabel createWithLabel:self frame:frame font:[UIFont systemFontOfSize:14 weight:UIFontWeightRegular] propertiesBlock:^(UILabel * _Nonnull label) {
            label.textColor = [UIColor colorWithHexString:@"#000000"];
            label.text = @"工单详情";
            label.userInteractionEnabled = YES;
        }];
    }
}

- (void)initWithMoreImgView {
    if (!_moreImgView) {
        UIImage *image = [UIImage imageNamed:@"ic-info-more"];
        CGRect frame = CGRectMake(self.width - 20 - image.size.width, (self.height - 1 - image.size.height) * 0.5, image.size.width, image.size.height);
        _moreImgView = [UIImageView createWithImageView:self frame:frame defaultImage:image propertiesBlock:^(UIImageView * _Nonnull imageView) {
            imageView.userInteractionEnabled = YES;
        }];
    }
}

@end
